import * as constants from './constants'

export const add = () => {
  console.log(123)
  return {
    type: constants.ADD
  }
}

export const reduce = () => ({
  type: constants.REDUCE
})
export const addAsync = (count) => {
  return (dispatch) => {
    setTimeout(() => {
      console.log(count)
      dispatch(add())
      dispatch(add())
      dispatch(add())
      dispatch(add())
    }, 2000);
  }
}
export const addTwice = () => {
  return [
    {
      type: constants.ADD
    },{
      type: constants.ADD
    }, {
      type: constants.ADD
    }, addAsync()
  ]
}